package cn.highedu.coolshark.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;

@Slf4j
@Configuration
public class PasswordEncoderConfig {

    /**
     * 为 Spring Security 提供密码加密器
     * @return 密码加密器
     */
    @Bean
    public PasswordEncoder passwordEncoder(){
        PasswordEncoder passwordEncoder =
                PasswordEncoderFactories.createDelegatingPasswordEncoder();
        log.debug("配置委托密码编码器 {}", passwordEncoder.getClass().getName());
        return passwordEncoder;
    }
}
